package ERMDE.models.tests;


import junit.framework.Assert;

import main.java.ERMDE.models.Cardinality;
import main.java.ERMDE.models.Entity;
import main.java.ERMDE.models.Interface;
import main.java.ERMDE.models.InvalidCardinalityException;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;


public class RelationshipEntityTestCase {

	@Test
	@Ignore
	public void testCreatingLeavesCardinalitiesAndRoleAsNull() {
		Entity entity = new Entity("TestName");

		Interface relationshipEntity = null;
		try {
			relationshipEntity = new Interface(entity);
		} catch (InvalidCardinalityException e) {
			e.printStackTrace();
		}
		Assert.assertNotNull(relationshipEntity);
		Assert.assertEquals(entity.getId(), relationshipEntity.getEntityId());
		Assert.assertNull(relationshipEntity.getCardinality());
		Assert.assertNull(relationshipEntity.getRole());
		Assert.assertFalse(relationshipEntity.isStrongEntity());
	}

	@Test
	public void testCreatingACompleteRelationshipEntity() throws Exception {
		Entity entity = new Entity("TestName");

		Interface relationshipEntity = new Interface(entity, new Cardinality(0,
				1), "role");

		Assert.assertEquals(entity.getId(), relationshipEntity.getEntityId());
		Assert.assertEquals(0.0, relationshipEntity.getCardinality()
				.getMinimum());
		Assert.assertEquals(1.0, relationshipEntity.getCardinality()
				.getMaximum());
		Assert.assertEquals("role", relationshipEntity.getRole());
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
}
